package cn.iocoder.yudao.module.book.dal.mysql.classes;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.book.controller.app.classes.vo.AppClassesSaveReqVO;
import cn.iocoder.yudao.module.book.dal.dataobject.classes.ClassesDO;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.book.controller.admin.classes.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 班级 Mapper
 *
 * @author xi
 */
@Mapper
public interface ClassesMapper extends BaseMapperX<ClassesDO> {

    default PageResult<ClassesDO> selectPage(ClassesPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ClassesDO>()
                .eqIfPresent(ClassesDO::getClassesId, reqVO.getClassesId())
                .likeIfPresent(ClassesDO::getCname, reqVO.getCname())
                .eqIfPresent(ClassesDO::getUserId, reqVO.getUserId())
                .eqIfPresent(ClassesDO::getCommand, reqVO.getCommand())
                .betweenIfPresent(ClassesDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ClassesDO::getClassesId));
    }

    boolean selectByClassCode(@Param("code") int code);

    Long getUserId(@Param("command") Integer command);

    void deleteByCommand(@Param("command") Integer command);

    List<ClassesDO> getClassByUserId(@Param("currentUserId") Long currentUserId);

    Integer getCommand(@Param("classesId") Integer classesId);
    
    /**
     * 直接SQL删除班级
     */
    void deleteClassById(@Param("classesId") Integer classesId);
    
    /**
     * 验证班级删除状态（不受逻辑删除影响）
     */
    Boolean checkClassDeleted(@Param("classesId") Integer classesId);

//    Boolean insertClasses(AppClassesSaveReqVO clas);
}